<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        * {
            padding: 0;
            margin: 0;
        }
        
        .box {
            width: 300px;
            height: 300px;
            margin: 30px auto;
            border: 1px solid black;
            perspective: 200px;
        }
        
        ul {
            width: 100px;
            height: 100px;
            margin: 100px;
            transform-style: preserve-3d;
            position: relative;
            transition: all 2s ease-in-out;
            transform-origin: center center -50px;
        }
        
        ul li {
            perspective: 300px;
            /* display: inline-block; */
            width: 100px;
            height: 100px;
            list-style: none;
            transform-style: preserve-3d;
            position: absolute;
        }
        
        ul li:nth-child(1) {
            top: 0;
            left: 0;
            background-color: red;
        }
        
        ul li:nth-child(2) {
            top: 0px;
            left: 100px;
            background-color: antiquewhite;
            transform-origin: left;
            transform: rotateY(90deg);
        }
        
        ul li:nth-child(3) {
            top: 0px;
            left: -100px;
            background-color: yellow;
            transform-origin: right;
            transform: rotateY(-90deg);
        }
        
        ul li:nth-child(4) {
            top: -100px;
            left: 0;
            background-color: violet;
            transform-origin: bottom;
            transform: rotateX(90deg);
        }
        
        ul li:nth-child(5) {
            top: 100px;
            left: 0px;
            background-color: aquamarine;
            transform: rotateX(-90deg);
            transform-origin: top;
        }
        
        ul li:nth-child(6) {
            top: 0px;
            left: 0px;
            transform: translateZ(-100px);
            background-color: bisque;
        }
        
        .box:hover ul {
            transform: rotateY(360deg);
        }
    </style>

</head>

<body>
    <div class="box">
        <ul>
            <li>1</li>
            <li>2</li>
            <li>3</li>
            <li>4</li>
            <li>5</li>
            <li>6</li>
        </ul>

    </div>


</body>

</html>